// EAM应用通用JavaScript功能
frappe.provide('eam');

eam.utils = {
    generate_qr_code: function(equipment_code) {
        frappe.call({
            method: 'eam.api.qr_code.generate',
            args: { equipment_code: equipment_code },
            callback: function(r) {
                if (r.message) {
                    frappe.msgprint('二维码生成成功');
                }
            }
        });
    },
    
    show_maintenance_history: function(equipment) {
        frappe.route_options = {"equipment": equipment};
        frappe.set_route("List", "Equipment Maintenance");
    }
};